package com.gitee.lirns.basement.entity.result;

import lombok.Data;

/**
 * 返回类型
 * @author  李瑞林
 * @date  2021/1/27 14:57
 */
@Data
public class Result {

    private Integer code;
    private String  message;
    private Object data;

    public Result(ResultCode resultCode,Object data) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
        this.data = data;
    }

    public static <T> Result success(T data){
        return new Result(ResultCode.SUCCESS,data);
    }

    public static <T> Result fail(T data){
        return new Result(ResultCode.ERROR,data);
    }

}
